home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Mac Game Programming Gurus
/
TricksOfTheMacGameProgrammingGurus.iso
/
More Source
/
C⁄C++
/
AIFF DSP v22
/
main_src
/
generic.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-30
|
659b
|
35 lines
#include <stdio.h>
#include <string.h>
#include "generic.h"
#include "aiff.h"
void safe_gets( char *s, int max_len )
{
int len;
fgets( s, max_len, stdin );
len = strlen(s);
if (len && s[len-1] == '\n')
s[len-1] = 0;
}
int generic_getfstr( char *infstr, int len )
{
fprintf( stderr, "input AIFF file name: " );
safe_gets( infstr, len );
return 0;
}
FILE *generic_open_ouf( void )
{
#define OUFSTR_LEN 300
char oufstr[OUFSTR_LEN];
FILE *ouf;
fprintf( stderr, "output AIFF file name: " );
safe_gets( oufstr, OUFSTR_LEN );
if ( !( ouf = fopen( oufstr, "wb" ) ) )
err( "opening output file" );
return ouf;
}